# Contributor: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
# Maintainer: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
pkgname=lsd
pkgver=0.22.0
pkgrel=0
pkgdesc="Next-Gen ls command"
url="https://github.com/Peltoche/lsd"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le"  # limited by rust/cargo
license="Apache-2.0"
makedepends="cargo"
source="${pkgname}-${pkgver}.tar.gz::https://github.com/Peltoche/$pkgname/archive/refs/tags/$pkgver.tar.gz"

prepare() {
	default_prepare

	# Optimize binary for size (https://opensourcelibs.com/lib/min-sized-rust).
	# Add strip = "symbols" optimization once it is out of nightly
	cat >> Cargo.toml <<-EOF

		[profile.release]
		codegen-units = 1
		lto = true
		opt-level = "z"
		panic = "abort"
	EOF
}

build() {
	cargo build --release --locked
}

check() {
	cargo test --release --locked
}

package() {
	cargo install --locked --path . --root="$pkgdir/usr"
	rm "$pkgdir"/usr/.crates*
}

sha512sums="
d6b0eba5edbe62d73dea6b971f43065c92e9a21671354b277317dc55c3d1680eedb5cdcea446cbac83050c9279fc4f140cfa7e7ef7c7e7714d9cea86e82ea250  lsd-0.22.0.tar.gz
"
